package cate.game.role.farm.adventure.task.msg;

import cate.common.annotation.OperationSetter;
import cate.common.table.d.GDOperation;
import cate.common.util.GameResult;
import cate.game.GameBody;
import cate.game.client.ClientContext;
import cate.game.client.msg.ClientMsg;
import cate.game.client.msg.MsgConfig;
import cate.game.client.msg.MsgInput;
import cate.game.client.msg.id.MsgIdBAdventure;
import easy.java.dev.note.NoteField;

import java.util.List;

@ClientMsg(title = "情报任务刷新 请求")
@OperationSetter(GDOperation.ADVENTURE_TASK_REFRESH)
public class RefreshTaskReq implements MsgInput {
    @NoteField("任务刷新方式,0免费刷新，1刷新券刷新，2元宝刷新")
    public int refreshMode;

    @Override
    public void execute(GameBody game, ClientContext cc) {
        GameResult<List<Integer>> r = cc.getRole().getFarm().adventure.task.refreshTask(refreshMode, true);
        if (!r.ok()) {
            game.notice.message(cc.getRole(), r);
        }
    }

    @Override
    public MsgConfig conf() {
        return MsgIdBAdventure.REFRESH_TASK_REQ;
    }
}
